package com.smalluz.ad.modules.oe.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

public interface ErrorCodeEnum {

    Integer getCode();

    String getMsg();

    @AllArgsConstructor
    @Getter
    enum AuthEnum implements ErrorCodeEnum {
        REQUEST_TOO_FREQUENT(40100, "请求过于频繁"),
        ERROR_CODE_INVALID_PARTNER(40101, "不合法的接入用户"),
        ACCESS_TOKEN_EXPIRE(40102, "access token过期"),
        REFRESH_TOKEN_EXPIRE(40103, "refresh token过期"),
        EMPTY_ACCESS_TOKEN(40104, "access token为空"),
        INVALID_ACCESS_TOKEN(40105, "access token错误"),
        INVALID_CORE_USER(40106, "账户登录异常"),
        INVALID_REFRESH_TOKEN(40107, "refresh token错误"),
        INVALID_GRANT_TYPE(40108, "授权类型错误"),
        ERROR_AES_DECIPHER(40109, "密码AES加密错误");
        private final Integer code;

        private final String msg;
    }

    @AllArgsConstructor
    @Getter
    enum SysErrorEnum implements ErrorCodeEnum {
        SYS_ERROR(50000, "系统错误"),
        SYS_ERROR_TIMEOUT(51010, "Internal service timeout, please try again later"),;

        private final Integer code;

        private final String msg;
    }

    @AllArgsConstructor
    @Getter
    enum CommonEnum implements ErrorCodeEnum {
        OK(0, "成功"),
        SYSTEM_ERROR(40001,  "参数错误【具体msg见返回信息】"),
        PERMISSION_ERROR(40002, "没有权限进行相关操作"),
        SQL_FILTER_FIELD_ERROR(40003, "过滤条件的field字段错误");
        private final Integer code;

        private final String msg;
    }

}
